# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=tracker3-miners
pkgver=3.6.2
pkgrel=1
pkgdesc="Filesystem indexer and metadata extractor"
url="https://tracker.gnome.org/"
arch=(loong64 x86_64)
license=(GPL)
depends=(
  exempi
  giflib
  gst-plugins-base-libs
  libcue
  libexif
  libgexiv2
  libgrss
  libgsf
  libgxps
  libiptcdata
  libnm
  libosinfo
  libseccomp
  poppler-glib
  totem-plparser
  tracker3
  upower
)
makedepends=(
  asciidoc
  git
  meson
)
checkdepends=(
  gst-libav
  gst-plugins-base
  gst-plugins-good
  python-gobject
  python-tappy
)
groups=(gnome)
_commit=c3f8ef3d7b4ec57b948992ddd8137db02f9d25b7  # tags/3.6.2^0
source=(
  "git+https://gitlab.gnome.org/GNOME/tracker-miners.git#commit=$_commit"
  tracker-miners-fix-build.patch
)
b2sums=('SKIP'
        'f9896f048312e8e5dd080d3fa07330abbf33277ef596db55e0693948dc823d3526ecc700307c35324ac0d95c1710af90a7237299baaef32e0d87858ebb7521ef')

pkgver() {
  cd tracker-miners
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd tracker-miners
}

build() {
  local meson_options=(
    -D tests_tap_protocol=true
  )

  arch-meson tracker-miners build "${meson_options[@]}"
  meson compile -C build
}

check() {
  # Intermittent test failures: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/79
  dbus-run-session meson test -C build --print-errorlogs -t 3 || :
}

package() {
  depends+=(libtracker-sparql-3.0.so)

  meson install -C build --destdir "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
